<template>
  <div class="check-area">
    <c-table-box
      class="area"
      :checkbox="!preview"
      hide-func
      :table-row-key="tableRowKey"
      :data="showTableData"
      :click-row-selection="false"
      :table-span-method="tableSpanMethod"
      :table-config="tableConfig"
      @selection-change="selectionChange"
    />
    <!-- <template v-if="$route.query.door !== 'yes'" #btn>
        <AddArea style="margin-right:10px;" :filters-raw="filtersRaw" @on-change="changeHandle" />
        <c-button type="primary" @click="removeHandle">删除</c-button>
      </template> -->
  </div>
</template>
<script>
// import AddArea from './addArea'
import { getSeriesByAccId } from '@/api/check'
import { otherFiltersItem } from '@/utils'
const rttf = ['Q014', 'Q015']
export default {
  name: 'CheckArea',
  components: {
    // AddArea
  },
  props: {
    preview: {
      type: Boolean,
      default: false
    },
    data: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {
      rawTableData: [],
      addTableData: [],
      tableConfig: {
        interfacePath: '',
        pageFlag: false,
        setting: [
          {
            prop: 'areaName',
            label: '所属区域',
            minWidth: 120,
            fixed: true
          },
          {
            prop: 'spaceName',
            label: '所属空间',
            minWidth: 120,
            fixed: true
          },
          {
            prop: 'isProgramOutpic',
            label: '是否出图',
            minWidth: 120,
            render: this.createIsOrNotOrText('isProgramOutpic', false)
          },
          {
            prop: '__actualOutpicArea',
            label: '出图面积',
            minWidth: 120
          },
          {
            prop: 'spaceAcceptArea',
            label: '验收面积',
            minWidth: 120,
            // render: this.switchEditAndText('spaceAcceptArea', true, this.createNumber, this.createIsOrNotOrText, true, { change: this.syncValue('spaceAcceptArea', '_groupSpace') })
            render: (h, row) => {
              const t = this.preview || row._groupSpace.some(e => e.isAccept === '1' || e.isAccept === 1)
              if (t) {
                return this.switchEditAndText('spaceAcceptArea', true, this.createNumber, this.createIsOrNotOrText, true, { change: this.syncValue('spaceAcceptArea', '_groupSpace') })(h, row)
              }
              if (row.spaceAcceptArea !== '') {
                this.syncValue('spaceAcceptArea', '_groupSpace')(row, '')
              }
              return h('div', '')
            }
          },
          {
            prop: 'spaceAcceptDesc',
            label: '验收说明',
            minWidth: 120,
            // render: this.switchEditAndText('spaceAcceptDesc', true, this.createTextInput, this.createIsOrNotOrText, true, { change: this.syncValue('spaceAcceptDesc', '_groupSpace') })
            render: (h, row) => {
              const t = this.preview || row._groupSpace.some(e => e.isAccept === '1' || e.isAccept === 1)
              if (t) {
                return this.switchEditAndText('spaceAcceptDesc', true, this.createTextInput, this.createIsOrNotOrText, true, { change: this.syncValue('spaceAcceptDesc', '_groupSpace') })(h, row)
              }
              if (row.spaceAcceptDesc !== '') {
                this.syncValue('spaceAcceptDesc', '_groupSpace')(row, '')
              }
              return h('div', '')
            }
          },
          {
            prop: 'styleName',
            label: '所属专区',
            minWidth: 120
          },
          {
            prop: 'floors',
            label: '所在楼层',
            minWidth: 120,
            edit: {
              canEdit: !this.preview,
              editType: 'text'
            }
          },
          {
            prop: '__styleActualOutpicArea',
            label: '出图面积',
            minWidth: 120
          },
          {
            prop: '__assortCustomizedArea',
            label: '配套定制出图面积',
            minWidth: 120
          },
          {
            prop: 'styleAcceptArea',
            label: '验收面积',
            minWidth: 120,
            // render: this.switchEditAndText('styleAcceptArea', false, this.createNumber, this.createIsOrNotOrText, true, { change: [this.syncValue('styleAcceptArea', '_groupStyle'), this.syncValueSum('styleAcceptArea', 'spaceAcceptArea', '_groupSpace', this.getStyleAcceptAreaValueGroup)] })
            render: (h, row) => {
              const t = this.preview || row._groupStyle.some(e => e.isAccept === '1' || e.isAccept === 1)
              if (t) {
                return this.switchEditAndText('styleAcceptArea', false, this.createNumber, this.createIsOrNotOrText, true, { change: [this.syncValue('styleAcceptArea', '_groupStyle'), this.syncValueSum('styleAcceptArea', 'spaceAcceptArea', '_groupSpace', this.getStyleAcceptAreaValueGroup)] })(h, row)
              }
              if (row.styleAcceptArea !== '') {
                this.syncValue('styleAcceptArea', '_groupStyle')(row, '')
                this.syncValueSum('styleAcceptArea', 'spaceAcceptArea', '_groupSpace', this.getStyleAcceptAreaValueGroup)(row, 0)
              }
              return h('div', '')
            }
          },
          {
            prop: 'assortAcceptArea',
            label: '配套定制验收面积',
            minWidth: 120,
            // render: this.switchEditAndText('assortAcceptArea', false, this.createNumber, this.createIsOrNotOrText, true, { change: [this.syncValue('assortAcceptArea', '_groupStyle')] })
            render: (h, row) => {
              const t = this.preview || row._groupStyle.some(e => e.isAccept === '1' || e.isAccept === 1)
              if (t) {
                return this.switchEditAndText('assortAcceptArea', false, this.createNumber, this.createIsOrNotOrText, true, { change: [this.syncValue('assortAcceptArea', '_groupStyle')] })(h, row)
              }
              if (row.assortAcceptArea !== '') {
                this.syncValue('assortAcceptArea', '_groupStyle')(row, '')
              }
              return h('div', '')
            }
          },
          {
            prop: 'styleAcceptDesc',
            label: '验收说明',
            minWidth: 120,
            // render: this.switchEditAndText('styleAcceptDesc', false, this.createTextInput, this.createIsOrNotOrText, true, { change: this.syncValue('styleAcceptDesc', '_groupStyle') })
            render: (h, row) => {
              const t = this.preview || row._groupStyle.some(e => e.isAccept === '1' || e.isAccept === 1)
              if (t) {
                return this.switchEditAndText('styleAcceptDesc', false, this.createTextInput, this.createIsOrNotOrText, true, { change: this.syncValue('styleAcceptDesc', '_groupStyle') })(h, row)
              }
              if (row.styleAcceptDesc !== '') {
                this.syncValue('styleAcceptDesc', '_groupStyle')(row, '')
              }
              return h('div', '')
            }
          },
          {
            prop: 'seriesName',
            label: '产品系列',
            minWidth: 120
          },
          {
            prop: 'chooseCustomizedSeriesName',
            label: '配套定制系列',
            minWidth: 120
          },
          {
            prop: 'chooseCupboardSeriesName',
            label: '配套橱柜系列',
            minWidth: 120
          },
          {
            prop: 'isDetailOutpic',
            label: '是否出图',
            minWidth: 120,
            render: this.createIsOrNotOrText('isDetailOutpic', false)
          },
          {
            prop: 'isAccept',
            label: '是否验收',
            minWidth: 120,
            render: this.switchEditAndText('isAccept', false, this.createSwitch, this.createIsOrNotOrText, false, {
              input: (v, row) => {
                (row._groupSeries || []).forEach(e => {
                  this.$set(e, 'isAccept', v)
                })
              }
            }, true)
          }
        ]
      },
      selections: [],
      // 过滤条件
      filtersRaw: [
        // 一下不能选择
        otherFiltersItem('areaCode', 'Q014', '<>'),
        otherFiltersItem('areaCode', 'Q015', '<>'),
        otherFiltersItem('areaCode', 'Q002', '<>'),
        otherFiltersItem('areaCode', 'Q003', '<>'),
        otherFiltersItem('areaCode', 'Q004', '<>'),
        otherFiltersItem('areaCode', 'Q005', '<>'),
        otherFiltersItem('enable', 1, '=')
      ],
      doorHeader: [] // 门楣数据
    }
  },
  computed: {
    showTableData() {
      return this.handleData([...this.data, ...this.rawTableData, ...this.addTableData])
    }
  },
  created() {
    !this.preview && this.getData()
  },
  methods: {
    getData() {
      const { id } = this.$route.query
      getSeriesByAccId(id).then(res => {
        this.rawTableData = (res.data || []).map(e => {
          if (e.isAccept === undefined || e.isAccept === '') {
            e.isAccept = '1'
          }
          return e
        })
      })
    },
    // 选择区域
    changeHandle(v) {
      v = v.map(e => {
        return {
          acceptId: this.$route.query.id, //	门店验收ID
          actualOutpicArea: '', //	空间出图面积
          areaCode: e.areaCode, //	所属区域编码
          areaName: e.areaName, //	所属区域名称
          assortAcceptArea: '', //	配套定制验收面积
          chooseCupboardSeriesCode: '', //	配套橱柜系列编码
          chooseCupboardSeriesName: '', //	配套橱柜系列名称
          assortCustomizedArea: '', //	配套定制出图面积
          chooseCustomizedSeriesCode: '', //	配套定制系列编码
          chooseCustomizedSeriesName: '', //	配套定制系列名称
          id: '', //	ID
          isAccept: '1', //	是否验收 0否 1是
          isDetailOutpic: '0', //	是否系列出图：0否1是
          isProgramOutpic: '0', //	空间是否出图：0否1是
          seriesCode: '', //	系列编码
          seriesName: '', //	系列名称
          spaceAcceptArea: '', //	空间验收面积
          spaceAcceptDesc: '', //	空间验收说明
          spaceCode: '', //	所属空间编码
          spaceName: '', //	所属空间名称
          styleAcceptArea: '', //	专区验收面积
          styleAcceptDesc: '', //	专区验收说明
          styleActualOutpicArea: '', //	专区出图面积
          styleCode: '', //	专区编码
          styleName: '', //	专区名称
          floors: undefined,
          types: 1 //	是否本次验收：0否1是
        }
      })
      this.addTableData.push(...v)
    },
    selectionChange(v) {
      this.selections = v
    },
    spaceEditable(row) {
      return !rttf.includes(row.areaCode)
    },
    // 可编辑与不可编辑
    switchEditAndText(key, rttf, editFun, textFun, isText, on, always) {
      return (h, row) => {
        if (this.preview) {
          return textFun(key, isText)(h, row)
        } else if (always) {
          return editFun(key, on)(h, row)
        }
        if (rttf) {
          if (this.spaceEditable(row)) {
            return editFun(key, on)(h, row)
          } else {
            return textFun(key, isText)(h, row)
          }
        } else {
          if (this.spaceEditable(row)) {
            return textFun(key, isText)(h, row)
          } else {
            return editFun(key, on)(h, row)
          }
        }
      }
    },
    // 是否
    createIsOrNotOrText(key, isText) {
      return (h, row) => {
        const v = row[key]
        if (!isText) {
          const text = (v === 1 || v === '1') ? '是' : '否'
          return h('span', text)
        } else {
          return h('span', v)
        }
      }
    },
    // switch
    createSwitch(key, on = {}) {
      on = { ...(on || {}) }
      const input = on.input
      delete on.input
      return (h, row) => {
        const _on = this.wrapHandle(on, row)
        const v = String(row[key] || 0)
        return h('el-switch', {
          props: {
            activeValue: '1',
            inactiveValue: '0',
            value: v
          },
          on: {
            input: v => {
              this.$set(row, key, v)
              if (input instanceof Function) {
                input.call(this, v, row)
              }
            },
            ..._on
          },
          nativeOn: {
            click: e => {
              e.stopPropagation && e.stopPropagation()
              return false
            }
          }
        })
      }
    },
    // number
    createNumber(key, on = {}) {
      on = { ...(on || {}) }
      const input = on.input
      delete on.input
      return (h, row) => {
        const _on = this.wrapHandle(on, row)
        const v = row[key]
        return h('c-input-number', {
          props: {
            float: true,
            value: v
          },
          on: {
            input: v => {
              this.$set(row, key, v)
              if (input instanceof Function) {
                input.call(this, v)
              }
            },
            ..._on
          },
          nativeOn: {
            click: e => {
              e.stopPropagation && e.stopPropagation()
              return false
            }
          }
        })
      }
    },
    // input
    createTextInput(key, on = {}) {
      on = { ...(on || {}) }
      const input = on.input
      delete on.input
      return (h, row) => {
        const _on = this.wrapHandle(on, row)
        const v = row[key]
        return h('el-input', {
          props: {
            value: v,
            type: 'textarea',
            autosize: { minRow: 1 }
          },
          attrs: {
            maxlength: 1024,
            showWordLimit: true
          },
          on: {
            input: v => {
              this.$set(row, key, v)
              if (input instanceof Function) {
                input.call(this, v)
              }
            },
            ..._on
          },
          nativeOn: {
            click: e => {
              e.stopPropagation && e.stopPropagation()
              return false
            }
          }
        })
      }
    },
    // 处理事件
    wrapHandle(on = {}, ..._args) {
      const t = {}
      Object.entries(on).forEach(function([event, handler]) {
        if (!(handler instanceof Array)) {
          handler = [handler]
        }
        t[event] = function(...args) {
          for (const h of handler) {
            h.call(this, ..._args, ...args)
          }
        }
      })
      return t
    },
    // 同步值
    syncValue(key, groupKey) {
      return (row, v) => {
        // const v = row[key]
        for (const item of row[groupKey] || []) {
          this.$set(item, key, v)
        }
      }
    },
    // 系列报图，出图同步到空间
    syncValueBySome(key, targetKey, groupKey) {
      const fun = this.syncValue(targetKey, groupKey)
      return (row, v) => {
        const group = row[groupKey] || []
        if (v === 1 || v === '1') {
          fun.call(this, row, v)
        } else {
          if (group.some(e => (e[key] === 1 || e[key] === '1'))) {
            fun.call(this, row, '1')
          } else {
            fun.call(this, row, '0')
          }
        }
      }
    },
    // 出图面积汇总
    syncValueSum(key, targetKey, targetGroupKey, getValueGroup) {
      const fun = this.syncValue(targetKey, targetGroupKey)
      return (row, v) => {
        let group
        if (getValueGroup instanceof Function) {
          group = getValueGroup(row, v)
        } else {
          group = row[targetGroupKey] || []
        }
        const value = group.reduce((a, b) => {
          if (typeof a !== 'object') {
            a = { [key]: a }
          }
          let tmp = Number(a[key])
          const a1 = isNaN(tmp) ? 0 : tmp
          tmp = Number(b[key])
          const b1 = isNaN(tmp) ? 0 : tmp
          return a1 + b1
        }, { [key]: 0 })
        fun.call(this, row, value)
      }
    },
    // 去掉重复的spaceAcceptArea
    getStyleAcceptAreaValueGroup(row, v) {
      const t = new Set();
      (row._groupSpace || []).forEach(e => {
        t.add((e._groupStyle || [])[0])
      })
      return Array.from(t)
    },

    tableSpanMethod({ row, column, rowIndex, columnIndex }) {
      if (this.preview) {
        // 区域
        if ([1].includes(columnIndex)) {
          return [row._areaRowSpan, 1]
        }
        // 空间
        if ([2, 3, 4, 5, 6].includes(columnIndex)) {
          return [row._spaceRowSpan, 1]
        }
        if ([7, 8, 9, 10, 11, 12].includes(columnIndex)) {
          return [row._styleRowSpan, 1]
        }
        if ([13, 14, 15, 16, 17].includes(columnIndex)) {
          return [row._seriesRowSpan, 1]
        }
      } else {
        // 区域
        if ([2].includes(columnIndex)) {
          return [row._areaRowSpan, 1]
        }
        // 空间
        if ([3, 4, 5, 6, 7].includes(columnIndex)) {
          return [row._spaceRowSpan, 1]
        }
        if ([8, 9, 10, 11, 12, 13].includes(columnIndex)) {
          return [row._styleRowSpan, 1]
        }
        if ([14, 15, 16, 17, 18].includes(columnIndex)) {
          return [row._seriesRowSpan, 1]
        }
      }
      return [1, 1]
    },
    // arg = {flag, index, groupKey, span}
    classifyFun(data, args) {
      const classify = {}
      const _args = [...args]
      const { flag, index, groupKey, span, handler } = _args.shift()
      for (const item of data) {
        // 先清理数据，方便二次处理
        Object.keys(item).forEach(key => {
          if (/^_.+/.test(key) && !/^__.+/.test(key)) {
            delete item[key]
          }
        })
        const f = item[flag] === undefined ? flag : item[flag]
        // const i = item[index] === undefined ? 0 : item[index]
        // const key = `${f}@@${i}`
        const key = `${f}`
        if (classify[key] === undefined) {
          classify[key] = {
            list: [],
            groupKey: `_${groupKey}`,
            span: `_${span}`,
            index: `_${index}`,
            order: item[index]
          }
        }
        if (classify[key].order === undefined) {
          classify[key].order = item[index]
        }
        classify[key].list.push(item)
      }
      if (handler instanceof Function) {
        Object.values(classify).forEach(e => {
          handler(e.list)
        })
      }
      if (_args.length > 0) {
        Object.values(classify).forEach(e => {
          e.classify = this.classifyFun(e.list, _args)
        })
      }
      return classify
    },
    handleData(data) {
      const doorHeader = data.filter(e => e.spaceCode === 'S125')
      this.doorHeader = doorHeader
      data = data.filter(e => e.spaceCode !== 'S125')
      // 按区域分类
      const args = [
        { flag: 'areaCode', index: 'areaIndex', groupKey: 'groupArea', span: 'areaRowSpan' },
        { flag: 'spaceCode', index: 'spaceIndex', groupKey: 'groupSpace', span: 'spaceRowSpan', handler: this.reduceActualOutpicArea },
        { flag: 'styleCode', index: 'styleIndex', groupKey: 'groupStyle', span: 'styleRowSpan', handler: this.reduceStyleActualOutpicArea },
        { flag: 'seriesCode', index: 'seriesIndex', groupKey: 'groupSeries', span: 'seriesRowSpan' }
      ]
      const area = this.classifyFun(data, args)
      // 排序函数
      const sort = (data, order = 'asc') => {
        const t = Object.entries(data)
        const l = t.length
        for (let i = 0; i < l; i++) {
          for (let m = i + 1; m < l; m++) {
            const a = t[i]
            // let i1 = Number(a[0].split('@@')[1])
            let i1 = Number(a[1].order)
            if (isNaN(i1)) { i1 = 0 }
            const b = t[m]
            // let i2 = Number(b[0].split('@@')[1])
            let i2 = Number(b[1].order)
            if (isNaN(i2)) { i2 = 0 }
            if (order === 'asc' && i1 > i2) {
              t.splice(i, 1, b)
              t.splice(m, 1, a)
            } else if (order === 'desc' && i1 < i2) {
              t.splice(i, 1, b)
              t.splice(m, 1, a)
            }
          }
        }
        return t
      }
      const result = []
      const collectFun = (data) => {
        const arrs = sort(data)
        arrs.forEach(e => {
          const t = e[1]
          // eslint-disable-next-line no-unused-vars
          const { list, classify, groupKey, span } = t
          list.forEach((e, i) => {
            e[groupKey] = list
          })
          if (classify) {
            collectFun(classify)
          } else {
            // 系列
            list.sort((a, b) => {
              const a1 = Number(a.seriesCode || 0)
              const b1 = Number(b.seriesCode || 0)
              return b1 - a1
            })
            result.push(...list)
          }
        })
      }
      collectFun(area)
      result.forEach((e, i) => {
        const merge = (row, flag, span, groupKey) => {
          if (row[flag]) return
          const list = row[groupKey]
          if (row[flag] === undefined) {
            list.forEach(e => {
              e[flag] = true
              e[span] = 0
            })
            row[span] = list.length
          }
        }
        merge(e, '_areaMerge', '_areaRowSpan', '_groupArea')
        merge(e, '_spaceMerge', '_spaceRowSpan', '_groupSpace')
        merge(e, '_styleMerge', '_styleRowSpan', '_groupStyle')
        merge(e, '_seriesMerge', '_seriesRowSpan', '_groupSeries')
        'isProgramOutpic isDetailOutpic isAccept'.split(' ').forEach(k => {
          if (e[k] === undefined || e[k] === 0) {
            this.$set(e, k, '0')
          }
        })
        if (e.unique_key === undefined) {
          this.$set(e, 'unique_key', (Math.random() * 0xfffff).toString(16))
        }
      })
      return result
    },
    reduceActualOutpicArea(list) {
      const t = {}
      list.forEach(e => {
        if (t[e.picTaskCode] === undefined) {
          t[e.picTaskCode] = []
        }
        t[e.picTaskCode].push(e)
      })
      let _actualOutpicArea = 0
      const pictrueStyles = [] // 同一个图纸，同一个专区
      // eslint-disable-next-line no-unused-vars
      for (const [picTaskCode, values] of Object.entries(t)) {
        _actualOutpicArea += values.reduce((p, c) => {
          if (!rttf.includes(c.areaCode)) {
            return p || c.actualOutpicArea || 0
          }
          const pictrueStyle = `${picTaskCode}${c.styleCode}`
          if (pictrueStyles.includes(pictrueStyle)) {
            return p || 0
          }
          pictrueStyles.push(pictrueStyle)
          return p + (c.styleActualOutpicArea || 0)
        }, 0)
      }
      list.forEach(e => {
        this.$set(e, '__actualOutpicArea', _actualOutpicArea)
      })
    },
    reduceStyleActualOutpicArea(list) {
      if (list.length > 0 && !rttf.includes(list[0].areaCode)) {
        list.forEach(e => {
          this.$set(e, '__styleActualOutpicArea', '')
          this.$set(e, '__assortCustomizedArea', '')
        })
        return
      }
      const t = {}
      list.forEach(e => {
        if (t[e.picTaskCode] === undefined) {
          t[e.picTaskCode] = e
        }
      })
      let _styleActualOutpicArea = 0
      let _assortCustomizedArea
      // eslint-disable-next-line no-unused-vars
      // for (const [picTaskCode, values] of Object.entries(t)) {
      //   _styleActualOutpicArea += values.reduce((p, c) => {
      //     if (!rttf.includes(c.areaCode)) {
      //       return p || c.styleActualOutpicArea || 0
      //     }
      //     return p + (c.styleActualOutpicArea || 0)
      //   }, 0)
      // }
      for (const [picTaskCode, value] of Object.entries(t)) {
        if (!rttf.includes(value.areaCode)) {
          _styleActualOutpicArea += value.styleActualOutpicArea || 0
          if (value.assortCustomizedArea || value.assortCustomizedArea === 0) {
            _assortCustomizedArea = (_assortCustomizedArea || 0) + value.assortCustomizedArea
          }
        }
        _styleActualOutpicArea += value.styleActualOutpicArea || 0
        if (value.assortCustomizedArea || value.assortCustomizedArea === 0) {
          _assortCustomizedArea = (_assortCustomizedArea || 0) + value.assortCustomizedArea
        }
      }
      list.forEach(e => {
        this.$set(e, '__styleActualOutpicArea', _styleActualOutpicArea)
        this.$set(e, '__assortCustomizedArea', _assortCustomizedArea)
      })
    },
    tableRowKey(row) {
      return row.unique_key
    },
    // 删除
    removeHandle() {
      if (!this.singleJudge(this.selections, '删除')) {
        return
      }
      this.rawTableData = this.rawTableData.filter(e => {
        return !this.selections.includes(e)
      })
      this.addTableData = this.addTableData.filter(e => {
        return !this.selections.includes(e)
      })
      this.selections = []
      this.$nextTick(() => {
        // 重新计算验收面积
        const fun = this.syncValueSum('styleAcceptArea', 'spaceAcceptArea', '_groupSpace', this.getStyleAcceptAreaValueGroup)
        for (const row of this.showTableData) {
          if (this.spaceEditable(row)) continue
          fun.call(this, row, row.styleActualOuiftpicArea)
        }
      })
    },
    getTableData() {
      const result = []
      for (let i = 0; i < this.showTableData.length; i++) {
        const v = { ...this.showTableData[i] }
        Object.keys(v).forEach(key => {
          if (/^_.+/.test(key) || key === 'unique_key') {
            delete v[key]
          }
        })
        result.push(v)
      }
      result.push(...this.doorHeader)
      return result
    },
    // 校验数据
    validate(isPromise = true) {
      const result = []
      const msg = (a, i, b) => {
        let m = typeof i === 'number' ? `${a}第${i + 1}行${b}!` : `${a}${i}${b}!`
        m = `本次验收：${m}`
        this.$message.warning(m)
        return isPromise ? Promise.reject(m) : false
      }
      for (let i = 0; i < this.showTableData.length; i++) {
        const v = { ...this.showTableData[i] }
        Object.keys(v).forEach(key => {
          if (/^_.+/.test(key) || key === 'unique_key') {
            delete v[key]
          }
        })
        if (this.$isTrue(v.isAccept, 1, '1')) {
          if (rttf.includes(v.areaCode)) {
            if (this.$gtZero(v.styleActualOutpicArea) && !this.$gtZero(v.styleAcceptArea)) {
              return msg('请填写【', v.styleName, '】验收面积')
            }
            if (this.$gtZero(v.assortCustomizedArea) && !this.$gtZero(v.assortAcceptArea)) {
              return msg('请填写【', v.styleName, '】配套定制验收面积')
            }
          } else {
            if (this.$gtZero(v.actualOutpicArea) && !this.$gtZero(v.spaceAcceptArea)) {
              return msg('请填写【', v.spaceName, '】验收面积')
            }
          }
        }
        result.push(v)
      }
      result.push(...this.doorHeader)
      return isPromise ? Promise.resolve(result) : result
    }
  }
}
</script>
<style lang="scss" scoped>
.check-area{
  .area{
    & /deep/ .el-table__row{
      background-color: #fff !important;
    }
    & /deep/ .hover-row{
      background-color: #fff !important;
    }
    & /deep/ td{
      background-color: #fff !important;
    }
  }
}
</style>
